﻿// -------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
// -------------------------------------------------------------------------------------------------

using Newtonsoft.Json;

namespace Microsoft.Health.Fhir.Core.Features.Search
{
    /// <summary>
    /// Represents the search result.
    /// </summary>
    public class SearchResultReindex
    {
        public SearchResultReindex()
        {
        }

        public SearchResultReindex(long count)
        {
            Count = count;
        }

        /// <summary>
        /// The count of items to reindex - only has value for cosmos
        /// </summary>
        public long Count { get; set; }

        /// <summary>
        /// The Min resource surrogate id for the resource
        /// </summary>
        public long StartResourceSurrogateId { get; set; }

        /// <summary>
        /// The Max resource surrogate id for the resource
        /// </summary>
        public long EndResourceSurrogateId { get; set; }

        /// <summary>
        /// The continuation token for the search results
        /// </summary>
        [JsonIgnore]
        public string ContinuationToken { get; set; }

        /// <summary>
        /// Determines whether the Count property should be serialized.
        /// </summary>
        public bool ShouldSerializeCount()
        {
            return Count != 0;
        }
    }
}
